import 'package:flutter/material.dart';
import 'package:flutter_saixiaoli/routes.dart';

class Classif extends StatelessWidget {
  final List classification;

  const Classif({Key key, this.classification}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.symmetric(vertical: 15, horizontal: 12),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: classification
            .map((item) => GestureDetector(
                  onTap: () {
                    switch (item['text']) {
                      case '成绩查询':
                        Navigator.pushNamed(context, Routes.scoreQueryList);
                        break;
                      default:
                    }
                  },
                  child: Column(
                    children: [
                      Container(
                        child: Image.asset(
                          item['image'],
                          width: 40,
                          height: 40,
                        ),
                      ),
                      Container(
                        margin: EdgeInsets.only(top: 20),
                        child: Text(item['text']),
                      )
                    ],
                  ),
                ))
            .toList(),
      ),
    );
  }
}
